Skip to content

Improve Resolve-Error command and allow default system prompt for the openai-gpt agent #397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 14, 2025

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Jul 12, 2025

PR Summary

This PR includes the following changes:

  1. Improve Resolve-Error

    • $? doesn't accurately reflect if the last command succeeded or failed. e.g., the last command is a function definition, and it raised parsing errors; the last command has multiple statements and the last command in it succeeded.
    • The old implementation requires a user to use fixit immediately after a failure. If they run another command, fixit won't be able to get the last error.

    This PR changed it to focus on the last error record:

    • If the command associated with the last error is exactly the last command in history, then that must be the one the user is looking for.
    • If the command associated with the last error is not the last command in history, and $LastErrorCode is null or 0, then the user should be looking at the last failure from a previous command run (not the very last command run).
    • If $LastErrorCode is non-zero and $? is false, then the last command must be a failing native command.
    • If $LastErrorCode is non-zero but $? is true, then it's not unknown which command/failure the user is looking at, so as the agent to look at the terminal content and figure out by itself.
  2. Change the temperature to be 0.5. Setting it to 0 make it too rigorous and loose the creativity to solve a task.

  3. Allow a default system prompt to be used when user's system prompt is not specified.

@daxian-dbw daxian-dbw merged commit cd50156 into PowerShell:main Jul 14, 2025
4 checks passed
@daxian-dbw daxian-dbw deleted the fixit branch July 14, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants